home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / asppw112 / dirfilee.asp < prev    next >
Encoding:
Text File  |  1999-01-07  |  2.0 KB  |  74 lines

  1. <HTML><BODY>
  2. <%
  3.     ' Method: IsDirExists(strDirPathName)
  4.     ' Method: IsFileExists(strFilePathName)
  5.     ' output: 1 succeed
  6.     '         0 not exists
  7.     '        -1 not exists, error
  8.  
  9.     ' Sample Operation:    
  10.     ' Real path on server is D:\inetpub\wwwroot\
  11.  
  12.     ' This file is provided as part of  ASP Power Widgets Samples
  13.     '
  14.     ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
  15.     ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
  16.     ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  17.     ' OF MERCHANTABILITY AND/OR FITNESS FOR A  PARTICULAR
  18.     ' PURPOSE.
  19.  
  20.     ' Copyright 1997-1998. All rights reserved.
  21.     ' Dalun Software Inc. ASP Power Widgets
  22.     ' http://www.dalun.com
  23.     ' http://members.tripod.com/ActiveServerPage/
  24.  
  25.     sDirPathName   = Server.MapPath("/")
  26.  
  27.     response.write "Directory """ & sDirPathName & """<br>"
  28.  
  29.     Set oFDMgt   = Server.CreateObject("ASPPW.FDMgt")
  30.     iReturnCode  = oFDMgt.IsDirExists (sDirPathName)
  31.  
  32.     select case iReturnCode
  33.         case    1:  response.write sDirPathName & " exists.<br>"
  34.         case 0,-1:  response.write sDirPathName & " not exists.<br>"
  35.     end select
  36.  
  37.     if oFDMgt.GetLastErrNum <> 0 then
  38.         response.write  oFDMgt.GetLastErrDescription
  39.     end if
  40.  
  41.     Set oFDMgt =nothing
  42.  
  43.     'Method: IsFileExists(strFilePathName)
  44.     '
  45.     'The sample directory's URL is 202.92.0.1/root/dirfileexists.asp
  46.     'Real path on server is D:\inetpub\wwwroot\dirfileexists.asp
  47.     'Delete directory "sample" and its all files and directories.
  48.  
  49.     sDir   = "dirfileexists.asp"
  50.     sFilePathName   = Server.MapPath("/") & "\" & sDir
  51.  
  52.     response.write "File """ & sFilePathName &  """<br>"
  53.  
  54.     Set oFDMgt   = Server.CreateObject("ASPPW.FDMgt")
  55.     iReturnCode  = oFDMgt.IsFileExists (sFilePathName)
  56.  
  57.     select case iReturnCode
  58.         case    1:  response.write sFilePathName & " exists."
  59.         case    0,-1:  response.write sFilePathName & " not exists."
  60.     end select
  61.  
  62.     if oFDMgt.GetLastErrNum <> 0 then
  63.         response.write  oFDMgt.GetLastErrDescription
  64.     end if
  65.     Set oFDMgt =nothing
  66.     
  67. %>
  68. </BODY></HTML>
  69.  
  70.  
  71.  
  72.  
  73.  
  74.